package com.vhall.component.entity.rebroadcast;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 红包表
 * red_packet
 */
@Data
@TableName("red_packet")
public class RedPacketEntity implements Serializable {
    /**
     * 红包ID（主键）
     *
     * @date 2021-02-25 10:27:54
     */
    @TableId(type = IdType.AUTO, value = "id")
    @JsonProperty(value = "id")
    private Long id;

    /**
     * 红包唯一标识ID，对外暴露接口使用这个字段
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("`uuid`")
    @JsonProperty(value = "uuid")
    private String uuid;

    @TableField("app_id")
    @JsonProperty(value = "app_id")
    private String appId;

    /**
     * 创建红包的第三方用户ID
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("account_id")
    @JsonProperty(value = "account_id")
    private Integer accountId;

    /**
     * 房间编号
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("room_id")
    @JsonProperty(value = "room_id")
    private String roomId;

    /**
     * 红包类型：0 随机金额红包（默认），1 均分金额红包
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("`type`")
    private Integer type;

    /**
     * 发送表情类型：1.红包，2.礼品
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("gift_type")
    @JsonProperty(value = "gift_type")
    private Integer giftType;

    /**
     * 红包描述信息
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("`describe`")
    private String describe;

    /**
     * 红包数量
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("`number`")
    private Integer number;

    /**
     * 红包金额
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("`amount`")
    private BigDecimal amount;

    /**
     * 红包领取条件：0 无限制参与, 1 分享参与, 2 口令参会, 3 填写问卷参与, 4 邀请人数
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("`condition`")
    private Integer condition;

    /**
     * conditions:4 邀请人数
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("invite_num")
    @JsonProperty(value = "invite_num")
    private Integer inviteNum;

    /**
     * 红包口令密码，当condition为2时，此字段必填
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("`password`")
    private String password;

    /**
     * 推送消息下发的频道
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("push_channel")
    @JsonProperty(value = "push_channel")
    private String pushChannel;

    /**
     * 红包开始时间
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("start_time")
    @JsonProperty(value = "start_time")
    private LocalDateTime startTime;

    /**
     * 退款状态:
     * 0 未退款
     * 1 已退款
     * 2 退款失败
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("refund_status")
    @JsonProperty(value = "refund_status")
    private Integer refundStatus;

    /**
     * 领取金额
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("get_amount")
    @JsonProperty(value = "get_amount")
    private BigDecimal getAmount;

    /**
     * 在线人数
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("online_user_count")
    @JsonProperty(value = "online_user_count")
    private Integer onlineUserCount;

    /**
     * 领取人数
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("get_user_count")
    @JsonProperty(value = "get_user_count")
    private Integer getUserCount;

    /**
     * 参与人数
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("joined_user_count")
    @JsonProperty(value = "joined_user_count")
    private Integer joinedUserCount;

    /**
     * 红包支付状态：0 等待支付 1 支付成功 2 支付失败
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("pay_status")
    @JsonProperty(value = "pay_status")
    private Integer payStatus;

    /**
     * 支付渠道：1.微信，2.支付宝，3.余额支付，0.其他
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("pay_channel")
    @JsonProperty(value = "pay_channel")
    private Integer payChannel;

    /**
     * 红包支付交易流水号
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("trade_no")
    @JsonProperty(value = "trade_no")
    private String tradeNo;

    /**
     * 扩展字段
     *
     * @date 2021-02-25 10:27:54
     */
    private String ext;

    /**
     * 是否已删除 0 表示未删除 1 表示已删除
     *
     * @date 2021-02-25 10:27:54
     */
    private Integer deleted;

    /**
     * 创建时间
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("created_at")
    @JsonProperty(value = "created_at")
    private LocalDateTime createdAt;

    /**
     * 删除时间
     *
     * @date 2021-02-25 10:27:54
     */
    @JsonIgnore
    @TableField("deleted_at")
    @JsonProperty(value = "deleted_at")
    @JSONField(serialize = false)
    private LocalDateTime deletedAt;

    /**
     * 更新时间
     *
     * @date 2021-02-25 10:27:54
     */
    @TableField("updated_at")
    @JsonProperty(value = "updated_at")
    private LocalDateTime updatedAt;


    @TableField(exist = false)
    @JsonProperty("refund_amount")
    private BigDecimal refundAmount = BigDecimal.ZERO;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table red_packet
     *
     * @date 2021-02-25 10:27:54
     */
    private static final long serialVersionUID = 1L;

    /**
     * @date 2021-02-25 10:27:54
     */
    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        RedPacketEntity other = (RedPacketEntity) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getUuid() == null ? other.getUuid() == null : this.getUuid().equals(other.getUuid()))
                && (this.getAccountId() == null ? other.getAccountId() == null : this.getAccountId().equals(other.getAccountId()))
                && (this.getRoomId() == null ? other.getRoomId() == null : this.getRoomId().equals(other.getRoomId()))
                && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
                && (this.getGiftType() == null ? other.getGiftType() == null : this.getGiftType().equals(other.getGiftType()))
                && (this.getDescribe() == null ? other.getDescribe() == null : this.getDescribe().equals(other.getDescribe()))
                && (this.getNumber() == null ? other.getNumber() == null : this.getNumber().equals(other.getNumber()))
                && (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount()))
                && (this.getCondition() == null ? other.getCondition() == null : this.getCondition().equals(other.getCondition()))
                && (this.getInviteNum() == null ? other.getInviteNum() == null : this.getInviteNum().equals(other.getInviteNum()))
                && (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword()))
                && (this.getPushChannel() == null ? other.getPushChannel() == null : this.getPushChannel().equals(other.getPushChannel()))
                && (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
                && (this.getRefundStatus() == null ? other.getRefundStatus() == null : this.getRefundStatus().equals(other.getRefundStatus()))
                && (this.getGetAmount() == null ? other.getGetAmount() == null : this.getGetAmount().equals(other.getGetAmount()))
                && (this.getOnlineUserCount() == null ? other.getOnlineUserCount() == null : this.getOnlineUserCount().equals(other.getOnlineUserCount()))
                && (this.getGetUserCount() == null ? other.getGetUserCount() == null : this.getGetUserCount().equals(other.getGetUserCount()))
                && (this.getJoinedUserCount() == null ? other.getJoinedUserCount() == null : this.getJoinedUserCount().equals(other.getJoinedUserCount()))
                && (this.getPayStatus() == null ? other.getPayStatus() == null : this.getPayStatus().equals(other.getPayStatus()))
                && (this.getPayChannel() == null ? other.getPayChannel() == null : this.getPayChannel().equals(other.getPayChannel()))
                && (this.getTradeNo() == null ? other.getTradeNo() == null : this.getTradeNo().equals(other.getTradeNo()))
                && (this.getExt() == null ? other.getExt() == null : this.getExt().equals(other.getExt()))
                && (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()))
                && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
                && (this.getDeletedAt() == null ? other.getDeletedAt() == null : this.getDeletedAt().equals(other.getDeletedAt()))
                && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));

    }

    /**
     * @date 2021-02-25 10:27:54
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUuid() == null) ? 0 : getUuid().hashCode());
        result = prime * result + ((getAccountId() == null) ? 0 : getAccountId().hashCode());
        result = prime * result + ((getRoomId() == null) ? 0 : getRoomId().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getGiftType() == null) ? 0 : getGiftType().hashCode());
        result = prime * result + ((getDescribe() == null) ? 0 : getDescribe().hashCode());
        result = prime * result + ((getNumber() == null) ? 0 : getNumber().hashCode());
        result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode());
        result = prime * result + ((getCondition() == null) ? 0 : getCondition().hashCode());
        result = prime * result + ((getInviteNum() == null) ? 0 : getInviteNum().hashCode());
        result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
        result = prime * result + ((getPushChannel() == null) ? 0 : getPushChannel().hashCode());
        result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
        result = prime * result + ((getRefundStatus() == null) ? 0 : getRefundStatus().hashCode());
        result = prime * result + ((getGetAmount() == null) ? 0 : getGetAmount().hashCode());
        result = prime * result + ((getOnlineUserCount() == null) ? 0 : getOnlineUserCount().hashCode());
        result = prime * result + ((getGetUserCount() == null) ? 0 : getGetUserCount().hashCode());
        result = prime * result + ((getJoinedUserCount() == null) ? 0 : getJoinedUserCount().hashCode());
        result = prime * result + ((getPayStatus() == null) ? 0 : getPayStatus().hashCode());
        result = prime * result + ((getPayChannel() == null) ? 0 : getPayChannel().hashCode());
        result = prime * result + ((getTradeNo() == null) ? 0 : getTradeNo().hashCode());
        result = prime * result + ((getExt() == null) ? 0 : getExt().hashCode());
        result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getDeletedAt() == null) ? 0 : getDeletedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        return result;
    }

    /**
     * @date 2021-02-25 10:27:54
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", uuid=").append(uuid);
        sb.append(", accountId=").append(accountId);
        sb.append(", sourceId=").append(roomId);
        sb.append(", type=").append(type);
        sb.append(", giftType=").append(giftType);
        sb.append(", describe=").append(describe);
        sb.append(", number=").append(number);
        sb.append(", amount=").append(amount);
        sb.append(", condition=").append(condition);
        sb.append(", inviteNum=").append(inviteNum);
        sb.append(", password=").append(password);
        sb.append(", pushChannel=").append(pushChannel);
        sb.append(", startTime=").append(startTime);
        sb.append(", refundStatus=").append(refundStatus);
        sb.append(", getAmount=").append(getAmount);
        sb.append(", onlineUserCount=").append(onlineUserCount);
        sb.append(", getUserCount=").append(getUserCount);
        sb.append(", joinedUserCount=").append(joinedUserCount);
        sb.append(", payStatus=").append(payStatus);
        sb.append(", payChannel=").append(payChannel);
        sb.append(", tradeNo=").append(tradeNo);
        sb.append(", ext=").append(ext);
        sb.append(", deleted=").append(deleted);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", deletedAt=").append(deletedAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}